﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using KPIS.GERP.SERVICE.DAL;
using KPIS.GERP.SERVICE.Model;

namespace KPIS.GERP.SERVICE.WorkflowService.WCFService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "CommandDaemon" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select CommandDaemon.svc or CommandDaemon.svc.cs at the Solution Explorer and start debugging.
    public class CommandDaemon : ICommandDaemon
    {
        public List<hrm_ps_commands> GetCommand(bool loadAll = false)
        {
            var results = new Command().Select(null, null, null);
            if(!loadAll)
            {
                results = (from r in results
                           where r.record_status == Common.ApprovedStatus && r.cmd_status != "R"
                           select r).ToList();
            }
            return results;
        }
    }
}
